﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace TankIt
{
    class Wall
    {
        Texture2D texture;
        float scale = 1f;
        Vector2 position;
        ContentManager content;
        float rotation;
        public BoundingBox bb;
        public char type;
        Engine gameEngine;
        Vector2 center;

        public Wall(float scale, ContentManager content, Vector2 position, float rotation,char type,Engine eng)
        {
            this.scale = scale;
            this.position = position;
            this.content = content;
            this.rotation = rotation;
            this.type=type;
            gameEngine=eng;
        }


        public void load()
        {
            //actualizar textura;
            if (type=='b') //brick wall
                texture = content.Load<Texture2D>("brickWall");
            else{ if (type=='s')
                    texture = content.Load<Texture2D>("steelWall");
                else{
                    if (type=='v')
                        texture = content.Load<Texture2D>("SteelWallVert");
                        
                    else texture = content.Load<Texture2D>("SteelWallHor");
                }

            }

            center=new Vector2(texture.Width / 2, texture.Height / 2);
            
            Vector3 cantoSup = new Vector3(position.X - texture.Width / 2, position.Y - texture.Height / 2, 0);
            Vector3 cantoInf = new Vector3(position.X + texture.Width / 2, position.Y + texture.Height / 2, 0);
            bb=new BoundingBox (cantoSup,cantoInf);
            
            }


        public void draw(SpriteBatch batch)
        {
            
            batch.Draw(texture, position, null, Microsoft.Xna.Framework.Color.White, rotation, center , scale, SpriteEffects.None, 0f);
        }

    }
    
}
